package pda;

import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * @author haoly
 * @title StackTest
 * @date 2025/4/21 09:49
 * @description TODO
 */
public class StackTest {
    @Test
    public void testMixed(){
        List<Character> initialList = Arrays.asList(
                'a', 'b', 'c', 'd', 'e');
        Stack<Character> stack = new Stack<>(initialList);
        System.out.println(stack);

        assertEquals('a', stack.top());
        assertEquals('a', stack.pop());
        assertEquals('b', stack.top());
        assertEquals('b', stack.pop());
        assertEquals('c', stack.top());

        stack.push('x');
        assertEquals('x', stack.top());
        stack.push('y');
        assertEquals('y', stack.top());

        stack.push('x');
        stack.push('y');
        stack.pop();
        assertEquals('x', stack.top());

    }

}
